<?php
PageUtil::addVar("javascript_body","<script type=\"text/javascript\" src=\"".$themepath."/framework/ckeditor/ckeditor.js\"></script>");
?>
<?php echo $map['js']; ?>
<div class ="col-md-1"></div>
 <div class ="col-md-10">
<section class="cat-widget wdg-cat-opposite clearfix">
  <div class="widget-title">
      <h3><a href="#">Add travel</a></h3>
      <span class="sub-title">เพิ่มที่ท่องเที่ยว</span>
      <div class="sep-widget"></div>
  </div>
   <section class="col-md-12">
  <form method="post" action="<?php echo base_url('travel/upload');?>" enctype="multipart/form-data">
  <div class="row">
      <div class="form-group">
        <div class="col-sm-3"></div>
        <!--<div class="col-sm-4">
          <img alt="Image Display Here" id="test" src="<?php echo $imagepath;?>/user.png" width="200px" height="200px"/>
          <input onchange="readURL(this);" type="file" />
        </div>-->
        </div>
      <?php if(!empty($resDetail["id"])){
        ?>
        <input type="hidden" class="form-control" name="id" value="<?php echo $resDetail["id"];?>">
        <?php
      }
      ?>
      </div>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label" for="username">ชื่อสถานที่ท่องเที่ยว</label>
        <div class="col-sm-4">
          <input type="text" class="col-sm-4 form-control required" name="name" id="username" value="<?php if(!empty($resDetail["name"])){ echo $resDetail["name"]; }?>"/>
        </div>
      </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label" for="username"></label>
        <div class="col-sm-5">
          <input type="text" class="col-sm-5 form-control required" name="title" id="username" value="<?php if(!empty($resDetail["title"])){ echo $resDetail["title"]; }?>"/>
        </div>
      </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label" for="address">รายละเอียด</label>
        <div class="col-sm-8">
          <textarea id="editor1" class="ckeditor" name="content"><?php if(!empty($traDetail["content"])){ echo $traDetail["content"]; }?></textarea>
        </div>
      </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-3 control-label">ประเภทหลัก(ที่เด่นที่สุด)</label>
        <div class="col-sm-4">
        <select name="tagDefault" class="form-control">
        <?php foreach( $traList as $key=>$value) { ?>
        <option><?php echo $value['name']; ?></option>
       <?php } ?>
      </select>
      </div>
        <div class="col-sm-3">
           
        </div>
        </div>
      </div><br/>
      <div class="row">
      <div class="form-group">
        <label class="col-sm-2 control-label">ประเภทรอง</label>
        <div class="col-sm-3">
       <?php foreach( $traList as $key=>$value) { ?>
            <label class="checkbox-inline">
            <input type="checkbox" name="tag[]" value="<?php echo $value['id']; ?>" id="gender[m]"><?php echo $value['name']; ?></label><br />
            <?php } ?>
        </div>
        </div>
      </div><br/>
      <div class="hidden">
        <?php 

          $dateTime = new DateTime('now', new DateTimeZone('Asia/Bangkok'));

        ?>
        <input type="text" class="col-sm-6 form-control required" name="comment_status" id="comment_status" value="1">
        <input type="text" class="col-sm-6 form-control required" name="update_date" id="update_date" value="<?php echo $dateTime->format('Y-m-d H:i:s');?>">
        <input type="text" class="col-sm-6 form-control required" name="view" id="view" value="1">
        <input type="text" class="col-sm-6 form-control required" name="cr_date" id="cr_date" value="<?php echo $dateTime->format('Y-m-d H:i:s');?>">
        <input type="text" class="col-sm-6 form-control required" name="lu_date" id="lu_date" value="<?php echo $dateTime->format('Y-m-d H:i:s');?>">
        <input type="text" class="col-sm-6 form-control required" name="lu-uid" id="lu-uid" value="1">
        <input type="text" class="col-sm-6 form-control required" name="comment_count" id="comment_count" value="1">
      </div>
       <div class="map col-md-offset-2">
        <?php echo $map['html']; ?>
      </div>
      <br />
       <div class="form-group hidden">
        <div class="col-sm-6 col-md-offset-2">
            <input type="text" class="col-sm-4 form-control required" name="lat" id="newLat" value="<?php if(!empty($resDetail["lat"])){ echo $resDetail["lat"]; }?>">
            <input type="text" class="col-sm-4 form-control required" name="lng" id="newLng" value="<?php if(!empty($resDetail["lng"])){ echo $resDetail["lng"]; }?>">
        </div>
      </div>
      <hr/>
    <div class="row">
      <div class="form-group">
      <div class="col-sm-2">
       <a href="#" class="thumbnail">
        <img alt="Image Display Here" id="test1" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
       </a>
      </div>
      <div class="col-sm-4"> 
           <input  onchange="readURL1(this);" type="file" name="image1"  />
      </div>
      <div class="col-sm-2">
      <a href="#" class="thumbnail">
        <img alt="Image Display Here" id="test2" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
      </a>
      </div>
      <div class="col-sm-4">
        <input onchange="readURL2(this);" type="file" name="image2"/>
      </div>
      </div>
    </div><hr/>
    <div class="row">
      <div class="form-group">
      <div class="col-sm-2">
      <a href="#" class="thumbnail">
        <img alt="Image Display Here" id="test3" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
      </a>
      </div>
      <div class="col-sm-4">
        <input onchange="readURL3(this);" type="file" name="image3"/>
      </div>
      <div class="col-sm-2">
      <a href="#" class="thumbnail">
        <img alt="Image Display Here" id="test4" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
      </a>
      </div>
      <div class="col-sm-4">
        <input onchange="readURL4(this);" type="file" name="image4"/>
      </div>
      </div>
    </div><hr/>
      <div class="row">
        <div class="form-group">
        <div class="col-sm-2">
        <a href="#" class="thumbnail">
          <img alt="Image Display Here" id="test5" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
        </a>
      </div>
      <div class="col-sm-4">
          <input onchange="readURL5(this);" type="file" name="image5"/>
      </div>
      <div class="col-sm-2">
        <a href="#" class="thumbnail">
          <img alt="Image Display Here" id="test6" src="<?php echo $imagepath;?>/t01.png" width="120px" height="120px"/>
        </a>
      </div>
      <div class="col-sm-4">
          <input onchange="readURL6(this);" type="file" name="image6"/>
      </div>
      </div>
    </div><hr/>
    <div class="form-group">
        <div class="col-sm-offset-5">
          <button type="submit" class="btn btn-primary" id="submitbtn" name="upload" value="upload">ยืนยัน</button>
          <a href="<?php echo base_url("admin/travel/");?>" class="btn btn-default">ยกเลิก</a>
        </div>
      </div>
  </form>
  </section>
</section>
</div>
<div class ="col-md-1"></div>
<script type="text/javascript">
    function addValue(newLat, newLng)
    {
      $('#newLat').val(newLat)
      $('#newLng').val(newLng)
    }
</script>
